#ifndef NETMAIN_H
#define NETMAIN_H

#include <QObject>
#include <QJsonArray>
class QTcpSocket;
class NetMain : public QObject
{
    Q_OBJECT
protected:
    explicit NetMain(QObject *parent = nullptr);

public:
    static NetMain *getObject();
    void sendStatus(const QJsonObject &obj);

signals:
    void modeChanged(int mode);

protected slots:
    void clientReadyReadSlot();

protected:
    void connectToHost();
    void sendIdentity();
    void handleFrame(const QJsonObject &obj);
    void handleModeFrame(const QJsonObject &obj);

    static NetMain *obj;
    QTcpSocket *client;

};

#endif // NETMAIN_H
